package com.msnjob.user;

import java.io.File;
import java.util.ArrayList;
import java.util.Date;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Vector;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts2.ServletActionContext;

import com.msnjob.MSNJobUitl;
import com.msnjob.base.MSNJobAction;
import com.opensymphony.xwork2.ActionContext;

import base.action.lib.BaseAction;
import base.db.lib.DBHelper;
import base.db.lib.util.ConncenFactory;
import base.util.lib.MD5;
import base.util.lib.String_Util;
/**
 * 个人注册相关功能
 * 
 * @author admin
 * 
 */
@SuppressWarnings("all")
public class PersonAction extends MSNJobAction implements java.io.Serializable {
	
	
	/**
	 * 通过MD5加密并返回客户端
	 * @return
	 * @throws Exception
	 */
	public String doMarkMD5() throws Exception {
		HttpServletRequest request = ServletActionContext.getRequest();
		Map userInfo=this.getUserInfo();
		String password=String_Util.doNull(request.getParameter("password"));
		MD5 md5 = new MD5();
		String pwd_md5 = md5.getkeyBeanofStr(password).toLowerCase(); 
		Map paramMap=null;
		 StringBuffer sql=new StringBuffer("");
		 sql.append(" select username,jobid,");
		 sql.append(" password ");
		 sql.append(" from person where lower(username)=?"); 
		sql.append(" and  lower(password)=?");
		Vector params = new Vector();
		params.add(((String)userInfo.get("username")).toLowerCase());
		params.add(pwd_md5.substring(8, 24));
		 Map usreobj=DBHelper.obj(sql.toString(),params);
		if( usreobj !=null){
			this.setAjaxMessage("yes");
		}else{
			this.setAjaxMessage("no");
		}
		ConncenFactory.colseConnection(); // 关闭连接
		return "ajax";
	}

	/**
	 * j修改密码
	 * @return
	 * @throws Exception
	 */
	public String doChangePass() throws Exception {
		HttpServletRequest request = ServletActionContext.getRequest();
		Map userInfo=this.getUserInfo();
		String username=(String)userInfo.get("username");//
	  //String_Util.doNull(request.getParameter("username"));
		String password=String_Util.doNull(request.getParameter("password"));
		MD5 md5 = new MD5();
		String pwd_md5 = md5.getkeyBeanofStr(password).toLowerCase(); 
		Vector params = new Vector();
		params.add(pwd_md5.substring(8, 24));
		params.add(username.toLowerCase());
		boolean flag=false;
		StringBuffer sql=new StringBuffer("update person set password=? where username=?");
		flag=DBHelper.execute(sql.toString(), params);
		ConncenFactory.commitAndClose(); // 关闭连接
	     this.setAjaxMessage(flag+"");
		return "ajax";
	}
	/**
	 * 登陆
	 * @return
	 * @throws Exception
	 */
	public String doLogin() throws Exception {
		HttpServletRequest request = ServletActionContext.getRequest();
		String password=String_Util.doNull(request.getParameter("password"));
		String username=String_Util.doNull(request.getParameter("username"));
		Map paramMap=null;
		 StringBuffer sql=new StringBuffer("");
		 sql.append(" select username,jobid,");
		 sql.append(" password,useremail,zazhi,zcdata,name,xingbie,minzu,xueli,hunyin,age,");
		 sql.append(" xuexiao,zhuanye,x_suozaidi,x_suozaidi1,x_suozaidi2,huji," +
		 		"huji1,huji2,shengao,tizhong,birthyear,");
		 sql.append(" birthmonth,birthday,dianhua,code,codetype,shouji,posts,address,zyclass,");
		 sql.append(" qq,byear,gerenzhuye,");
		 sql.append(" i_question,i_answer,pingjia ");
		 sql.append(" from person where lower(username)=?"); 
		// sql.append(" and lower(password)=?");
		Vector params = new Vector();
		params.add(username.toLowerCase());
		
		MD5 md5 = new MD5();
		String pwd_md5 = md5.getkeyBeanofStr(password).toLowerCase(); //
		//params.add(pwd_md5.substring(8, 24));
		//md5 16位的加密
	  //paramObject.put("password", pwd_md5.substring(8, 24));
	    Map usreobj=DBHelper.obj(sql.toString(),params);
	    if(usreobj !=null){//登录成功则修改登录时间已经登录次数
	    	//update person set llcs=ISNULL(dlcs,0)+1,dlsj=? where  username='2006889'
	    	Vector params_update = new Vector();
	    	params_update.add(new Date());
	    	params_update.add(username.toLowerCase());
	    	DBHelper.execute("update person set llcs=ISNULL(dlcs,0)+1,dlsj=? where  lower(username)=?", params_update);
	       request.getSession().setAttribute("user", usreobj);
	    }
	    
	    ConncenFactory.commitAndClose();
	    
		 return "ajax";
	}
	
	/**
	 * 第一步注册  注册进度：用户协议、填写帐号 -> 确认帐号信息 -> 基本资料填写 -> 完成注册 
	 *处理第一步注册信息
	 * Register.asp
	 * @return
	 * @throws Exception
	 */
	public String doRegOne() throws Exception {
		//第一注册信息
		// 采用连接池
		HttpServletRequest request = ServletActionContext.getRequest();
		Map paramObject=new HashMap();
		String password=String_Util.doNull(request.getParameter("password"));
		String username=String_Util.doNull(request.getParameter("v_username"));
		String jobid=this.getGenerateId().substring(0, 15);
		Map paramMap=null;
		
		String sql="select username from person where lower(username)=?";
		Vector params = new Vector();
		params.add(username.toLowerCase());
	   Map obj=DBHelper.obj(sql.toString(),params);
		paramMap=this.getRequestParams();
		paramMap.put("jobid", jobid);
		//存储用户信息
		//request.getSession().setAttribute("user", paramMap);
		request.setAttribute("user", paramMap);
	   if(obj !=null){
		   //用户存在
		 //获取页面参数值
		   return "regtwo";  
	   } 
		if(!"".equals(password) && !"".equals(username) ){
			try {
				//获取页面参数值。
				this.setInsertOrUpdateParams(paramObject);

				//asp时间戳  唯一性,没有重复
				paramObject.put("jobid", jobid);
				//密码采用MD5加密
				MD5 md5 = new MD5();
				String pwd_md5 = md5.getkeyBeanofStr(password).toLowerCase(); // 
				//md5 16位的加密
				paramObject.put("password", pwd_md5.substring(8, 24));
//			'conn.execute "insert into person (jobid,username,password,useremail,zazhi) values 
//			('"&jobid&"','"&username&"','"&password&"','"&useremail&"',"&zazhi&")"
				DBHelper.add("person", paramObject);
				//采用事务提交
				ConncenFactory.commitAndClose(); // 关闭连接
				
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
		//this.setAjaxMessage(flag);
		 return "regtwo";
	}
	/**
	 * 第二步注册  注册进度：用户协议、填写帐号 -> 确认帐号信息 -> 基本资料填写 -> 完成注册 
	 * 出来确定账号信息
	 * Register.asp
	 * @return
	 * @throws Exception
	 */
	public String doRegTwo() throws Exception {
		//第一注册信息
		// 采用连接池
		HttpServletRequest request = ServletActionContext.getRequest();
		Map	paramMap=this.getRequestParams();
		request.setAttribute("user", paramMap);
		return "regthree";
	}
	/**
	 * 第二步注册  注册进度：用户协议、填写帐号 -> 确认帐号信息 -> 基本资料填写 -> 完成注册 
	 * 出来确定账号信息
	 * Register.asp
	 * @return
	 * @throws Exception
	 */
	public String doRegThree() throws Exception {
		//第一注册信息
		// 采用连接池
		HttpServletRequest request = ServletActionContext.getRequest();
		Map	paramMap=this.getRequestParams();
		request.setAttribute("user", paramMap);
//		 select  username,jobid,
//		 password,useremail,zazhi,zcdata,ip,name,xingbie,minzu,xueli,hunyin,age,
//		 xuexiao,zhuanye,x_suozaidi,x_suozaidi1,huji,huji1,shengao,tizhong,birthyear,
//		 birthmonth,birthday,dianhua,code,codetype,shouji,posts,address,zyclass
//		 ,qq,byear,gerenzhuye,
//		 dlsj,xgsj,dlcs,lxbm,jlbm,photopb,phototre,zhengshutre,llcs,
//		 mbsys,jobtype,rctype,
//		 i_question,i_answer,pingjia
//		 from person
		String username=String_Util.doNull(request.getParameter("username"));
		String jobid=String_Util.doNull(request.getParameter("jobid"));;
		String condition_SQL=" where username='"+username+"'  ";// and jobid='"+jobid+"' ";
		Map paramObject=new HashMap();
		//注册时间
		paramObject.put("zcdata", new Date());
		String ip=request.getRemoteAddr();//this.getIpAddr();
		paramObject.put("ip", ip);
		//获取页面参数值。
		this.setInsertOrUpdateParams(paramObject);
		
		//初始用户基本信息
		//dlsj,xgsj,dlcs,lxbm,jlbm,photopb,phototre,zhengshutre,llcs,mbsys,jobtype,rctype,
		//"&now()&"','"&now()&"',1,0,0,1,0,0,0,1,1,1,
		paramObject.put("dlsj", new Date());
		paramObject.put("xgsj", new Date());
		//其余在页面添加

		DBHelper.update("person", paramObject,condition_SQL);
		
		
		//查询刚刚注册用户信息
		
		//采用事务提交
		ConncenFactory.commitAndClose(); // 关闭连接
		 return "ajax";
	}
	/**
	 * 
	 * 
	 * 	修改基本信息
	 * @return
	 * @throws Exception
	 */
	public String updateBaseInfo() throws Exception {
		
		// 采用连接池
		HttpServletRequest request = ServletActionContext.getRequest();
		
		String username=String_Util.doNull(request.getParameter("username"));
		String jobid=String_Util.doNull(request.getParameter("jobid"));;
		String condition_SQL=" where username='"+username+"'   and jobid='"+jobid+"' ";
		Map paramObject=new HashMap();
//		//注册时间
//		paramObject.put("zcdata", new Date());
		String ip=request.getRemoteAddr();//this.getIpAddr();
		paramObject.put("ip", ip);
		//获取页面参数值。
		this.setInsertOrUpdateParams(paramObject);
		//修改时间
		paramObject.put("xgsj", new Date());
		
		DBHelper.update("person", paramObject,condition_SQL);
		
		

		//获取最新更改信息

		Map userInfo=this.getUserInfo();
		if(userInfo !=null){
		String username_params=(String)userInfo.get("username");//
		Map paramMap=null;
		 StringBuffer sql=new StringBuffer("");
		 sql.append(" select username,jobid,");
		 sql.append(" password,useremail,zazhi,zcdata,name,xingbie,minzu,xueli,hunyin,age,");
		 sql.append(" xuexiao,zhuanye,x_suozaidi,x_suozaidi1,x_suozaidi2,huji," +
		 		"huji1,huji2,shengao,tizhong,birthyear,");
		 sql.append(" birthmonth,birthday,dianhua,code,codetype,shouji,posts,address,zyclass,");
		 sql.append(" qq,byear,gerenzhuye,");
		 sql.append(" i_question,i_answer,pingjia ");
		 sql.append(" from person where lower(username)=?"); 
		Vector params = new Vector();
		params.add(username_params);
		 request.getSession().setAttribute("user", null);
		  Map usreobj=DBHelper.obj(sql.toString(),params);
		 request.getSession().setAttribute("user", usreobj);
		}
		//采用事务提交
		ConncenFactory.commitAndClose(); // 关闭连接
		 return "index";
	}
	
	/**
	 * 
	 * 
	 * 	修改基本信息
	 * @return
	 * @throws Exception
	 */
	public String updateBaseInfo0000() throws Exception {
		
		// 采用连接池
		HttpServletRequest request = ServletActionContext.getRequest();
		
		String username=String_Util.doNull(request.getParameter("username"));
		String jobid=String_Util.doNull(request.getParameter("jobid"));;
		String condition_SQL=" where username='"+username+"'   and jobid='"+jobid+"' ";
		Map paramObject=new HashMap();
//		//注册时间
//		paramObject.put("zcdata", new Date());
		String ip=request.getRemoteAddr();//this.getIpAddr();
		paramObject.put("ip", ip);
		//获取页面参数值。
		this.setInsertOrUpdateParams(paramObject);
		//修改时间
		paramObject.put("xgsj", new Date());
		
		DBHelper.update("person", paramObject,condition_SQL);
		
		

		//获取最新更改信息

		Map userInfo=this.getUserInfo();
		if(userInfo !=null){
		String username_params=(String)userInfo.get("username");//
		Map paramMap=null;
		 StringBuffer sql=new StringBuffer("");
		 sql.append(" select username,jobid,");
		 sql.append(" password,useremail,zazhi,zcdata,name,xingbie,minzu,xueli,hunyin,age,");
		 sql.append(" xuexiao,zhuanye,x_suozaidi,x_suozaidi1,x_suozaidi2,huji," +
		 		"huji1,huji2,shengao,tizhong,birthyear,");
		 sql.append(" birthmonth,birthday,dianhua,code,codetype,shouji,posts,address,zyclass,");
		 sql.append(" qq,byear,gerenzhuye,");
		 sql.append(" i_question,i_answer,pingjia ");
		 sql.append(" from person where lower(username)=?"); 
		Vector params = new Vector();
		params.add(username_params);
		 request.getSession().setAttribute("user", null);
		  Map usreobj=DBHelper.obj(sql.toString(),params);
		 request.getSession().setAttribute("user", usreobj);
		}
		//采用事务提交
		ConncenFactory.commitAndClose(); // 关闭连接
		 return "index";
	}
	
	
	/**
	 * 检查邮箱是否被注册了
	 * @return
	 * @throws Exception
	 */
	public String checkMail() throws Exception {
		// 采用连接池
		HttpServletRequest request = ServletActionContext.getRequest();
		String mail=String_Util.doNull(request.getParameter("v_useremail"));
		String flag="true";
		if(!"".equals(mail)){
			String sql="select useremail from person where lower(useremail)=?";
			Vector params = new Vector();
			params.add(mail.toLowerCase());
		    Map obj=DBHelper.obj(sql.toString(),params);
		   if(obj !=null){
			   flag="false";
		   }   
		}
		this.setAjaxMessage(flag); 
		ConncenFactory.colseConnection(); // 关闭连接
		return "ajax";
	}
	/**
	 * 检查邮箱是否被注册了
	 * @return
	 * @throws Exception
	 */
	public String checkUsername() throws Exception {
		// 采用连接池
		HttpServletRequest request = ServletActionContext.getRequest();
		String username=String_Util.doNull(request.getParameter("v_username"));
		String flag="true";
		if(!"".equals(username)){
			//select username from person where lower(username)=lower('minky521@163.com');
			String sql="select username from person where lower(username)=?";
			Vector params = new Vector();
			params.add(username.toLowerCase());
		   Map obj=DBHelper.obj(sql.toString(),params);
		   if(obj !=null){
			   flag="false";
		   } 
		}
		this.setAjaxMessage(flag); 
		ConncenFactory.colseConnection(); // 关闭连接
		return "ajax";
	}

	public String execute() throws Exception {
		HttpServletRequest request = ServletActionContext.getRequest();
		System.out.println("ajax");
		return "ajax";
	}
	
	
	/**
	 *返回个人图片管理页面
	 * @return
	 * @throws Exception
	 */
	public String goToPic() throws Exception {
		// 采用连接池
		HttpServletRequest request = ServletActionContext.getRequest();
		Map userInfo=this.getUserInfo();
		if(userInfo !=null){
		Vector params = new Vector();
		params.add((String)userInfo.get("username"));
		params.add((String)userInfo.get("jobid"));
		StringBuffer sql=new StringBuffer("select username,name,jobid,photopb,photo,phototre from person where username=? and jobid=?");
		Map picinfo=DBHelper.obj(sql.toString(), params);
		request.setAttribute("picinfo", picinfo);
		ConncenFactory.colseConnection(); // 关闭连接    // 关闭连接
		}
		return "person.pic";
	}
	/**
	 * 根据flag参数处理图片上显示  （0屏蔽  1恢复）
	 * @return
	 * @throws Exception
	 */
	public String doDisAble() throws Exception {
		// 采用连接池
		HttpServletRequest request = ServletActionContext.getRequest();
		String flag=request.getParameter("flag");
		boolean  mesg=false;
		Map userInfo=this.getUserInfo();
		if(userInfo !=null){
			Vector params = new Vector();
			params.add(flag);
			params.add((String)userInfo.get("username"));
			params.add((String)userInfo.get("jobid"));
			//{phototre=1, photopb=1, username=200688, name=王建勇, photo=2006251055.jpg, jobid=pqdl91njf0}
			StringBuffer sql=new StringBuffer("update person  set photopb=?  where username=? and jobid=?");
			mesg= DBHelper.execute(sql.toString(), params);
			ConncenFactory.commitAndClose(); // 关闭连接    // 关闭连接
		}
		
		this.setAjaxMessage(mesg+"");
		return "ajax";
	}
	
	/**
	 *个人主页信息
	 * @return
	 * @throws Exception
	 */
	public String doIndex() throws Exception {
		// 采用连接池
		HttpServletRequest request = ServletActionContext.getRequest();
		String flag=request.getParameter("flag");
		
		Map userInfo=this.getUserInfo();
		if(userInfo !=null){
			Vector params = new Vector();
			params.add((String)userInfo.get("username"));
			params.add((String)userInfo.get("jobid"));

			StringBuffer sql=new StringBuffer("select jobid,dlcs,dlsj,xgsj,name,photo,photopb,phototre,Pingjia,jinengzhuanchang,selectedjob1 from person");
			sql.append(" where username=? and jobid=?");
			
			Map personInfo=DBHelper.obj(sql.toString(), params);
			request.setAttribute("personInfo", personInfo);
			ConncenFactory.colseConnection();
		}
		
		return "person.index";
	}
	
	/**
	 *个人教育培训信息页面
	 * @return
	 * @throws Exception
	 */
	public String goEdus() throws Exception {
		// 采用连接池
		HttpServletRequest request = ServletActionContext.getRequest();
		String flag=request.getParameter("flag");
		
		Map userInfo=this.getUserInfo();
		if(userInfo !=null){
			Vector params = new Vector();
			params.add((String)userInfo.get("username"));
			params.add((String)userInfo.get("jobid"));
          //个人专业信息
			StringBuffer sql=new StringBuffer("select username,name,jobid,xueli,xuexiao,byear,zyclass,zhuanye from person ");
			sql.append(" where username=? and jobid=?");
			
			Map personInfo=DBHelper.obj(sql.toString(), params);
			request.setAttribute("personInfo", personInfo);
			
  //教育
 //select * from [edus] where edutype=0 and username='wangzeping' and jobid='"&jobid&
			Vector params_edus = new Vector();
			params_edus.add((String)userInfo.get("username"));
			params_edus.add((String)userInfo.get("jobid"));
			params_edus.add("0");
			StringBuffer sql_edus=new StringBuffer("");
			sql_edus.append(" select * from edus  ");
			sql_edus.append(" where username=? and jobid=? and edutype=?");
			//教育 教育集合
			List eduslist=DBHelper.list(sql_edus.toString(), params_edus);
			request.setAttribute("eduslist", eduslist);
			//培训集合
			Vector params_px = new Vector();
			params_px.add((String)userInfo.get("username"));
			params_px.add((String)userInfo.get("jobid"));
			params_px.add("1");
			StringBuffer sql_px=new StringBuffer("");
			sql_px.append(" select * from edus  ");
			sql_px.append(" where username=? and jobid=? and edutype=?");
			//培训集合
			List pxlist=DBHelper.list(sql_px.toString(), params_px);
			request.setAttribute("pxlist", pxlist);
			
			ConncenFactory.colseConnection();
		}
		
		return "person.edus";
	}
	
	/**
	 *添加教育或培训
	 * @return
	 * @throws Exception
	 */
	public String addEdus() throws Exception {
	    Map paramObject=new HashMap();
		Map userInfo=this.getUserInfo();
		if(userInfo !=null){	
			//获取页面参数值。
			this.setInsertOrUpdateParams(paramObject);
			paramObject.put("jobid", (String)userInfo.get("jobid"));
			paramObject.put("username", (String)userInfo.get("username"));
			DBHelper.add("edus", paramObject);
			//采用事务提交
			ConncenFactory.commitAndClose(); // 关闭连接
		}
		return null;
	}
	/**
	 *教育 培训 》》》修改教育培训  》最大学历
	 * @return
	 * @throws Exception
	 */
	public String updateBaseEdus() throws Exception {
	    Map paramObject=new HashMap();
		Map userInfo=this.getUserInfo();
		if(userInfo !=null){
			//获取页面参数值。
			this.setInsertOrUpdateParams(paramObject);
			String con_sql= " where username='"+(String)userInfo.get("username")+"' and jobid='"+(String)userInfo.get("jobid")+"'";
			DBHelper.update("person", paramObject,con_sql);
			//采用事务提交
			ConncenFactory.commitAndClose(); // 关闭连接
		}
		return null;
	}
	
	
	/**
	 *简历管理》》教育 培训 》》删除功能
	 * @return
	 * @throws Exception
	 */
	public String delEdus() throws Exception {
	    boolean flag=false;
		Map userInfo=this.getUserInfo();
		HttpServletRequest request = ServletActionContext.getRequest();
		String edus_id=request.getParameter("edus_id");
		if(userInfo !=null){
			Vector params = new Vector();
			params.add((String)userInfo.get("username"));
			params.add((String)userInfo.get("jobid"));
			params.add(edus_id);
			StringBuffer sql=new StringBuffer("delete from edus ");
              sql.append(" where username=? and jobid=? and edus_id=?");
              flag=DBHelper.execute(sql.toString(), params);
			//采用事务提交
			ConncenFactory.commitAndClose(); // 关闭连接
		}
		this.setAjaxMessage(flag+"");
		return "ajax";
	}
	
	
	/**
	 *简历管理》》教育 培训 》》技能专长
	 * @return
	 * @throws Exception
	 */
	public String gotoSkill() throws Exception {
	  //  boolean flag=false;
		Map userInfo=this.getUserInfo();
		HttpServletRequest request = ServletActionContext.getRequest();

		if(userInfo !=null){
			Vector params = new Vector();
			params.add((String)userInfo.get("username"));
			params.add((String)userInfo.get("jobid"));
			
			StringBuffer sql=new StringBuffer("select username,name,jobid,jsjshuiping,language_one,language_two,l_OneAbility,l_twoAbility,mandarinLevel,jinengzhuanchang,skillkey from person ");
              sql.append(" where username=? and jobid=? ");
              Map skillobj=DBHelper.obj(sql.toString(), params);
              request.setAttribute("skillobj", skillobj);
			//采用事务提交
			ConncenFactory.colseConnection(); // 关闭连接
		}
		//this.setAjaxMessage(flag+"");
		return "person.skill";
	}
	
	/**
	 *简历管理》》工作经历 》》
	 * @return
	 * @throws Exception
	 */
	public String gotoWork() throws Exception {
	  //  boolean flag=false;
		Map userInfo=this.getUserInfo();
		HttpServletRequest request = ServletActionContext.getRequest();

		if(userInfo !=null){
			Vector params = new Vector();
			params.add((String)userInfo.get("username"));
			params.add((String)userInfo.get("jobid"));
//			select w_id,h_year,h_month,e_year,e_month,companyname,jobname from [works] where
//			   username='guotinghong'
             //工作经历集合
			StringBuffer sql=new StringBuffer("select w_id,h_year,h_month,e_year,e_month,companyname,jobname from works ");
              sql.append(" where username=? and jobid=? ");
              List joblist=DBHelper.list(sql.toString(), params);
              request.setAttribute("joblist", joblist);
			//采用事务提交
			ConncenFactory.colseConnection(); // 关闭连接
		}
		//this.setAjaxMessage(flag+"");
		return "person.work";
	}
	
	/**
	 *简历管理》》工作经历 》》删除功能
	 * @return
	 * @throws Exception
	 */
	public String delWork() throws Exception {
	    boolean flag=false;
		Map userInfo=this.getUserInfo();
		HttpServletRequest request = ServletActionContext.getRequest();
		String w_id=request.getParameter("w_id");
		if(userInfo !=null){
			Vector params = new Vector();
			params.add((String)userInfo.get("username"));
			params.add((String)userInfo.get("jobid"));
			params.add(w_id);
			StringBuffer sql=new StringBuffer("delete from works ");
              sql.append(" where username=? and jobid=? and w_id=?");
              flag=DBHelper.execute(sql.toString(), params);
			//采用事务提交
			ConncenFactory.commitAndClose(); // 关闭连接
		}
		this.setAjaxMessage(flag+"");
		return "ajax";
	}
	/**
	 *简历管理》》工作经历 》》goto编辑页面
	 * @return
	 * @throws Exception
	 */
	public String gotoEditWork() throws Exception {
	   
		Map userInfo=this.getUserInfo();
		HttpServletRequest request = ServletActionContext.getRequest();
		String w_id=request.getParameter("w_id");
		if(userInfo !=null){
			Vector params = new Vector();
			params.add((String)userInfo.get("username"));
			params.add((String)userInfo.get("jobid"));
			params.add(w_id);
			StringBuffer sql=new StringBuffer("select w_id,h_year,h_month,e_year,e_month," +
					"companyname,companytype,trade," +
					"jobname,workdescription from works ");
              sql.append(" where username=? and jobid=? and w_id=?");
              Map workobj=DBHelper.obj(sql.toString(), params);
              request.setAttribute("workobj", workobj);
			//采用事务提交
			ConncenFactory.colseConnection(); // 关闭连接
		}
		
		return "person.edit.work";
	}
	
	/**
	 *简历管理》》工作经历 》》出来编辑功能
	 * @return
	 * @throws Exception
	 */
	public String doEditWork() throws Exception {
		 Map paramObject=new HashMap();
			Map userInfo=this.getUserInfo();
			HttpServletRequest request = ServletActionContext.getRequest();
			String w_id=request.getParameter("w_id");
			if(userInfo !=null){
				//获取页面参数值。
				this.setInsertOrUpdateParams(paramObject);
				String con_sql= " where username='"+(String)userInfo.get("username")+"' and jobid='"
				+(String)userInfo.get("jobid")+"' and w_id='"+w_id+"'";
				DBHelper.update("works", paramObject,con_sql);
				//采用事务提交
				ConncenFactory.commitAndClose(); // 关闭连接
			}
		
		return "person.edit.work";
	}
	
	
	/**
	 *简历管理》》工作经历 》》添加
	 * @return
	 * @throws Exception
	 */
	public String addWork() throws Exception {
	    boolean flag=false;
		 Map paramObject=new HashMap();
			Map userInfo=this.getUserInfo();
			if(userInfo !=null){	
				//获取页面参数值。
				this.setInsertOrUpdateParams(paramObject);
				paramObject.put("jobid", (String)userInfo.get("jobid"));
				paramObject.put("username", (String)userInfo.get("username"));
				DBHelper.add("works", paramObject);
				//采用事务提交
				ConncenFactory.commitAndClose(); // 关闭连接
			}
			
//			 jingyan=request.form("jingyan")
//			 if not isnumeric(jingyan) then
//			  closedb
//			  response.redirect "error.asp?action=2"
//			  response.End()
//			 end if
//			 conn.execute "update person set jingyan="&jingyan&" where username='"&username&"' and jobid='"&jobid&"'"
//			 closedb
//			 response.redirect "jobseeker.asp"
			
		this.setAjaxMessage(flag+"");
		return "ajax";
	}
	
	/**
	 *简历管理》》教育 培训 》》技能专长  修改
	 * @return
	 * @throws Exception
	 */
	public String updateSkill() throws Exception {
	    Map paramObject=new HashMap();
		Map userInfo=this.getUserInfo();
		if(userInfo !=null){
			//获取页面参数值。
			this.setInsertOrUpdateParams(paramObject);
			String con_sql= " where username='"+(String)userInfo.get("username")+"' and jobid='"+(String)userInfo.get("jobid")+"'";
			DBHelper.update("person", paramObject,con_sql);
			//采用事务提交
			ConncenFactory.commitAndClose(); // 关闭连接
		}
		return null;
	}
	
	/**
	 *简历管理》》求职意向
	 * @return
	 * @throws Exception
	 */
	public String gotoJobseeker() throws Exception {
	    Map paramObject=new HashMap();
		Map userInfo=this.getUserInfo();
		HttpServletRequest request = ServletActionContext.getRequest();
		if(userInfo !=null){
			Vector params = new Vector();
			params.add((String)userInfo.get("username"));
			params.add((String)userInfo.get("jobid"));
			
//			select username,name,jobid,fazhanfangxiang,s_pwl1,s_pwl2,s_pwl3,daiyuyaoqiu,
//			negotiable,providehouseneeded,availopts,availnotice,other,jobtype,selectedjob1,
//			selectedjob2,selectedjob3 
//			from person where jobid=@jobid and username=@username

			StringBuffer sql=new StringBuffer(" ");
			sql.append(" select username,name,jobid,fazhanfangxiang,s_pwl1,s_pwl2,s_pwl3,daiyuyaoqiu,");
			sql.append(" negotiable,providehouseneeded,availopts,availnotice,other,jobtype,selectedjob1," );
			sql.append(" selectedjob2,selectedjob3  from person ");
            sql.append(" where username=? and jobid=? ");
              Map jobobj=DBHelper.obj(sql.toString(), params);
              request.setAttribute("jobobj", jobobj);
			//采用事务提交
			ConncenFactory.colseConnection(); // 关闭连接
		}
		//Jobseeker
		return "person.jobseeker";
	}
	
	/**
	 *简历管理》》保存求职意向
	 * @return
	 * @throws Exception
	 */
	public String doJobseeker() throws Exception {
	    Map paramObject=new HashMap();
		Map userInfo=this.getUserInfo();
		HttpServletRequest request = ServletActionContext.getRequest();
		if(userInfo !=null){
			this.setInsertOrUpdateParams(paramObject);
			String selectedjobs[]=request.getParameterValues("slt_selectedjobs");
			String selectedplaces[]=request.getParameterValues("slt_selectedplaces");
			//工作 类型
			for(int i=0; i<selectedjobs.length;i++){
				paramObject.put("selectedjob"+(i+1), selectedjobs[i]);
			}
			//工作 地点
			for(int i=0; i<selectedplaces.length;i++){
				paramObject.put("s_pwl"+(i+1), selectedplaces[i].replaceAll("-", ""));
			}
			
//			{selectedplaces=广东东莞, 
//				category=计算机业(IT)类, jobtype=1, workplacearea=北京-, 
//				availopts=1, providehouseneeded=1, availnotice=半,
//				negotiable=1, 
//				daiyuyaoqiu=2000, selectedjobs=行政/人事类-人事助理}
			//获取页面参数值。
		
			paramObject.remove("selectedplaces");
			paramObject.remove("category");
			paramObject.remove("workplacearea");
			paramObject.remove("workplacecity");
			paramObject.remove("selectedjobs");
			paramObject.remove("subcategory");
			System.out.println(paramObject);
			String con_sql= " where username='"+(String)userInfo.get("username")+"' and jobid='"+(String)userInfo.get("jobid")+"'";
			DBHelper.update("person", paramObject,con_sql);
			//采用事务提交
			ConncenFactory.commitAndClose(); // 关闭连接
		}
		//Jobseeker
		return null;
	}

	/**
	 *简历管理》》个人简历预览
	 * @return
	 * @throws Exception
	 */
	public String gotoJianli() throws Exception {
	    Map paramObject=new HashMap();
	
		HttpServletRequest request = ServletActionContext.getRequest();
		String jobid=request.getParameter("jobid");
			Vector params = new Vector();
			params.add(jobid);
			StringBuffer sql=new StringBuffer("select jobid,llcs from person where jobid= ?");
              Map obj=DBHelper.obj(sql.toString(), params);
              if(obj==null){
            	  //不存在
            	  return null;
              }
            StringBuffer base_sql=new StringBuffer("");
             base_sql.append("  select mbsys, username,jobid,name,xingbie,minzu,hunyin,age,x_suozaidi,");
             base_sql.append("  x_suozaidi1,x_suozaidi2,huji,huji1,huji2,shengao,birthyear,birthmonth,birthday,");
             base_sql.append("  dianhua,useremail,qq,gerenzhuye,pingjia,tizhong,codetype,code,");
             base_sql.append("  tizhong,dlsj,xueli,xuexiao,zhuanye,shengao,photo,jsjshuiping,jinengzhuanchang,");
             base_sql.append("  daiyuyaoqiu,negotiable,selectedjob1,selectedjob2,selectedjob3,");
             base_sql.append("  s_pwl1,s_pwl2,s_pwl3,availopts,availnotice,providehouseneeded,");
             base_sql.append("  fazhanfangxiang,pingjia,other,dianhua,shouji,gerenzhuye,qq,posts,address,useremail,");
             base_sql.append(" shouji,posts,address from person  where jobid= ?");
            //基本信息
             Map baseinfo=DBHelper.obj(base_sql.toString(), params);
             //教育培訓
             StringBuffer school_sql=new StringBuffer(" select * from edus where jobid= ? order by edutype");
             List sclist=DBHelper.list(school_sql.toString(), params);
             request.setAttribute("sclist", sclist) ;
             //工作
             StringBuffer work_sql=new StringBuffer(" select * from works where jobid= ?");
             List wrlist_temp=DBHelper.list(work_sql.toString(), params);
             List wrlist=new ArrayList();
             for(int i=0;i<wrlist_temp.size();i++){
            	 Map tempmap=(Map)wrlist_temp.get(i); 
            	 tempmap.put("companytype", MSNJobUitl.getCompanyTypeBycode(Integer.parseInt((String)tempmap.get("companytype"))));
            	 tempmap.put("trade", MSNJobUitl.getTradeTypeBycode(Integer.parseInt((String)tempmap.get("trade"))));
            	 wrlist.add(tempmap);
             }
             request.setAttribute("wrlist", wrlist) ;
             //基本信息转换
             changBaseInfo(baseinfo);
             request.setAttribute("baseinfo", baseinfo) ;
			//采用事务提交
			ConncenFactory.colseConnection(); // 关闭连接
		
		//Jobseeker
		return "person.jianli";
	}
	public void changBaseInfo(Map map){
		
		if("1".equals(map.get("xingbie"))){
			map.put("xingbie","男");
		}else{
			map.put("xingbie","女");
		}
		if("0".equals(map.get("hunyin"))){
			map.put("hunyin","保密");
		}else if("1".equals(map.get("hunyin"))){
			map.put("hunyin","未婚");
		}else if("2".equals(map.get("hunyin"))){
			map.put("hunyin","已婚");
		}else if("3".equals(map.get("hunyin"))){
			map.put("hunyin","离异");
		}else{
			map.put("hunyin","保密");
		}
		
		if("1".equals(map.get("negotiable"))){
			map.put("negotiable","(可面议)");
		}else{
			map.put("negotiable","(不面议)");
		}
		
		
		if("1".equals(map.get("availopts"))){
			map.put("availopts","可随时到职");
		}else{
			map.put("availopts", map.get("availnotice")+"个月以后");
		}
		
		if("0".equals(map.get("jobtype"))){
			map.put("jobtype","全职/兼职");
		}else if("1".equals(map.get("jobtype"))){
			map.put("jobtype","全职");
		}else if("2".equals(map.get("jobtype"))){
			map.put("jobtype","兼职");
		}else{
			map.put("jobtype","全职");
		}
//		if(null==map.get("daiyuyaoqiu")){
//			map.put("daiyuyaoqiu","面议");
//		}
//		dy=rs("daiyuyaoqiu")
//		if dy=null or dy="面议" then
//		 dy="面议"
//		 Negotiable=""
//		else
//		 dy="￥"&dy&"元/月"
//		 if rs("Negotiable")="1"then
//		  Negotiable="(可面议)"
//		 else
//		  Negotiable="(不面议)"
//		 end if
//		end if
//		if rs("availOpts")=1 then
//		 availOpts="可随时到职"
//		else
//		 availOpts=rs("availNotice")&"个月以后"
//		end if
//		jobtype=rs("jobtype")
//		select case jobtype
//		 case 0 jobtype="全职/兼职"
//		 case 1 jobtype="全职"
//		 case 2 jobtype="兼职"
//		end select
		
		if("1".equals(map.get("providehouseneeded"))){
			map.put("providehouseneeded","提供");
		}else{
			map.put("providehouseneeded","不提供");
		}
//		provideHouseNeeded=rs("provideHouseNeeded")
//		if provideHouseNeeded=1 then
//		 provideHouseNeeded="提供"
//		else
//		 provideHouseNeeded="不提供"
//		end if
		
		
		if("0".equals(map.get("codetype"))){
			map.put("codetype","身份证");
		}else if("1".equals(map.get("codetype"))){
			map.put("codetype","护 照");
		}else if("2".equals(map.get("codetype"))){
			map.put("codetype","军官证");
		}else if("3".equals(map.get("codetype"))){
			map.put("codetype","学生证");
		}else{
			map.put("codetype","其他证件");
		}
		
		
		
//		codetype=rs("codetype")
//		select case codetype
//		 case 0 codetype="身份证"
//		 case 1 codetype="护 照"
//		 case 2 codetype="军官证"
//		 case 3 codetype="学生证"
//		 case 4 codetype="其他证件"
//		end select
		
		
		if("0".equals(map.get("codetype"))){
			map.put("codetype","身份证");
		}else if("1".equals(map.get("codetype"))){
			map.put("codetype","护 照");
		}else if("2".equals(map.get("codetype"))){
			map.put("codetype","军官证");
		}else if("3".equals(map.get("codetype"))){
			map.put("codetype","学生证");
		}else{
			map.put("codetype","其他证件");
		}
		if(!"0".equals(map.get("l_oneability"))){
			
			if("0".equals(map.get("language_one"))){
				map.put("language_one","英语");
			}else if("1".equals(map.get("language_one"))){
				map.put("language_one","日语");
			}else if("2".equals(map.get("language_one"))){
				map.put("language_one","法语");
			}else if("3".equals(map.get("language_one"))){
				map.put("language_one","德语");
			}else if("4".equals(map.get("language_one"))){
				map.put("language_one","本阿拉伯语");
			}else if("5".equals(map.get("language_one"))){
				map.put("language_one","朝鲜语");
			}else if("6".equals(map.get("language_one"))){
				map.put("language_one","朝鲜语");
			}else if("7".equals(map.get("language_one"))){
				map.put("language_one","西班牙语");
			}else if("8".equals(map.get("language_one"))){
				map.put("language_one","俄语");
			}else if("9".equals(map.get("language_one"))){
				map.put("language_one","其他语言");
			}else{
				map.put("language_one","其他语言");
			}
			
			
			if("0".equals(map.get("l_oneability"))){
				map.put("l_oneability","");
			}else if("1".equals(map.get("l_oneability"))){
				map.put("l_oneability","(一般)");
			}else if("2".equals(map.get("l_oneability"))){
				map.put("l_oneability","(良好)");
			}else if("3".equals(map.get("l_oneability"))){
				map.put("l_oneability","(熟练)");
			}else{
				map.put("l_oneability","(精通)");
			}		
		}
		if("0".equals(map.get("l_oneability"))){
			map.put("l_oneability","");
		}
		
		
     if(!"0".equals(map.get("l_twoability"))){	
			if("0".equals(map.get("language_two"))){
				map.put("language_two","英语");
			}else if("1".equals(map.get("language_two"))){
				map.put("language_two","日语");
			}else if("2".equals(map.get("language_two"))){
				map.put("language_two","法语");
			}else if("3".equals(map.get("language_two"))){
				map.put("language_two","德语");
			}else if("4".equals(map.get("language_two"))){
				map.put("language_two","本阿拉伯语");
			}else if("5".equals(map.get("language_two"))){
				map.put("language_two","朝鲜语");
			}else if("6".equals(map.get("language_two"))){
				map.put("language_two","朝鲜语");
			}else if("7".equals(map.get("language_two"))){
				map.put("language_two","西班牙语");
			}else if("8".equals(map.get("language_two"))){
				map.put("language_two","俄语");
			}else if("9".equals(map.get("language_two"))){
				map.put("language_two","其他语言");
			}else{
				map.put("language_two","其他语言");
			}
			
			
			if("0".equals(map.get("l_twoability"))){
				map.put("l_twoability","");
			}else if("1".equals(map.get("l_twoability"))){
				map.put("l_twoability","(一般)");
			}else if("2".equals(map.get("l_twoability"))){
				map.put("l_twoability","(良好)");
			}else if("3".equals(map.get("l_twoability"))){
				map.put("l_twoability","(熟练)");
			}else{
				map.put("l_twoability","(精通)");
			}		
		}
		if("0".equals(map.get("l_twoability"))){
			map.put("l_twoability","");
		}
		
		
//		if rs("l_OneAbility")<>0 then
//		 select case rs("language_one")
//		  case 0 lan="英语"
//		  case 1 lan="日语"
//		  case 2 lan="法语"
//		  case 3 lan="德语"
//		  case 4 lan="阿拉伯语"
//		  case 5 lan="朝鲜语"
//		  case 6 lan="西班牙语" 
//		  case 7 lan="俄语"
//		  case 8 lan="意大利语"
//		  case 9 lan="其他语言"
//		 end select
//		 select case rs("l_OneAbility")
//		  case 1 lan2="(一般)"
//		  case 2 lan2="(良好)"
//		  case 3 lan2="(熟练)"
//		  case 4 lan2="(精通)"
//		 end select
//		 language=lan&lan2
//		end if
//
//		if rs("l_twoAbility")<>0 then
//		 select case rs("language_two")
//		  case 0 lan="英语"
//		  case 1 lan="日语"
//		  case 2 lan="法语"
//		  case 3 lan="德语"
//		  case 4 lan="阿拉伯语"
//		  case 5 lan="朝鲜语"
//		  case 6 lan="西班牙语" 
//		  case 7 lan="俄语"
//		  case 8 lan="意大利语"
//		  case 9 lan="其他语言"
//		 end select
//		 select case rs("l_twoAbility")
//		  case 1 lan2="(一般)"
//		  case 2 lan2="(良好)"
//		  case 3 lan2="(熟练)"
//		  case 4 lan2="(精通)"
//		 end select
//		 language=language&"；"&lan&lan2
//		end if
//		if rs("mandarinLevel")<>0 then
//		 select case rs("mandarinLevel")
//		  case 1 lan2="(一般)"
//		  case 2 lan2="(良好)"
//		  case 3 lan2="(优秀)"
//		  case 4 lan2="(标准)"
//		 end select
//		 language=language&"；普通话"&lan2
//		end if
		
		if("0".equals(map.get("mandarinlevel"))){
			map.put("mandarinlevel","");
		}else if("1".equals(map.get("mandarinlevel"))){
			map.put("mandarinlevel","(一般)");
		}else if("2".equals(map.get("mandarinlevel"))){
			map.put("mandarinlevel","(良好)");
		}else if("3".equals(map.get("mandarinlevel"))){
			map.put("mandarinlevel","(熟练)");
		}else{
			map.put("mandarinlevel","(精通)");
		}		
//		jsjshuiping=rs("jsjshuiping")
//		select case jsjshuiping
//		  case 0 jsjshuiping="没有获得任何证书"
//		  case 1 jsjshuiping="初 级"
//		  case 2 jsjshuiping="中 级"
//		  case 3 jsjshuiping="高 级"
//		  case 4 jsjshuiping="高校非计算机专业二级"
//		  case 5 jsjshuiping="高校非计算机专业三级(偏软)"
//		  case 6 jsjshuiping="高校非计算机专业三级(偏硬)"
//		  case 7 jsjshuiping="初级程序员"
//		  case 8 jsjshuiping="程序员"
//		  case 9 jsjshuiping="高级程序员"
//		  case 10 jsjshuiping="系统分析员"
//		  case 11 jsjshuiping="网络程序员"
//		  case 12 jsjshuiping="网络设计师"
		
		if("0".equals(map.get("jsjshuiping"))){
			map.put("jsjshuiping","没有获得任何证书");
		}else if("1".equals(map.get("jsjshuiping"))){
			map.put("jsjshuiping","初 级");
		}else if("2".equals(map.get("jsjshuiping"))){
			map.put("jsjshuiping","中 级");
		}else if("3".equals(map.get("jsjshuiping"))){
			map.put("jsjshuiping","高 级");
		}else if("4".equals(map.get("jsjshuiping"))){
			map.put("jsjshuiping","高校非计算机专业二级");
		}else if("5".equals(map.get("jsjshuiping"))){
			map.put("jsjshuiping","高校非计算机专业三级(偏软)");
		}else if("6".equals(map.get("jsjshuiping"))){
			map.put("jsjshuiping","高校非计算机专业三级(偏硬)");
		}else if("7".equals(map.get("jsjshuiping"))){
			map.put("jsjshuiping","初级程序员");
		}else if("8".equals(map.get("jsjshuiping"))){
			map.put("jsjshuiping","程序员");
		}else if("9".equals(map.get("jsjshuiping"))){
			map.put("jsjshuiping","高级程序员");
		}else if("10".equals(map.get("jsjshuiping"))){
			map.put("jsjshuiping","系统分析员");
		}else if("11".equals(map.get("jsjshuiping"))){
			map.put("jsjshuiping","网络程序员");
		}else if("12".equals(map.get("jsjshuiping"))){
			map.put("jsjshuiping","网络设计师");
			
//			  case 13 jsjshuiping="全国计算机等级考试一级"
//			  case 14 jsjshuiping="全国计算机等级考试二级"
//			  case 15 jsjshuiping="全国计算机等级考试三级"
//			  case 16 jsjshuiping="全国计算机等级考试四级"
//			  case 17 jsjshuiping="微软认证产品专家(MCP)"
//			  case 18 jsjshuiping="微软认证网站建造专家(MCP+Site  Builder)"
//			  case 19 jsjshuiping="微软认证系统工程师(MCSE)"
//			  case 20 jsjshuiping="微软认证数据库管理员(MCDBA)"
//			  case 21 jsjshuiping="微软认证开发专家(MCSD)"
//			  case 22 jsjshuiping="Cisco职业资格认证CCNA" 
//			  case 23 jsjshuiping="Cisco职业资格认证CCDP" 
//			  case 24 jsjshuiping="Cisco职业资格认证CCNP "
//			  case 25 jsjshuiping="Cisco职业资格认证CCIE" 
//			  case 26 jsjshuiping="Oracle8数据库管理员" 
//			  case 27 jsjshuiping="Lotus资格认证 "
		}else if("13".equals(map.get("jsjshuiping"))){
			map.put("jsjshuiping","全国计算机等级考试一级");
		}else if("14".equals(map.get("jsjshuiping"))){
			map.put("jsjshuiping","全国计算机等级考试二级");
		}else if("15".equals(map.get("jsjshuiping"))){
			map.put("jsjshuiping","全国计算机等级考试三级");
		}else if("16".equals(map.get("jsjshuiping"))){
			map.put("jsjshuiping","全国计算机等级考试四级");
		}else if("17".equals(map.get("jsjshuiping"))){
			map.put("jsjshuiping","软认证产品专家(MCP)");
		}else if("18".equals(map.get("jsjshuiping"))){
			map.put("jsjshuiping","微软认证网站建造专家(MCP+Site  Builder)");
		}else if("19".equals(map.get("jsjshuiping"))){
			map.put("jsjshuiping","微软认证系统工程师(MCSE)");
		}else if("20".equals(map.get("jsjshuiping"))){
			map.put("jsjshuiping","微软认证数据库管理员(MCDBA)");
		}else if("21".equals(map.get("jsjshuiping"))){
			map.put("jsjshuiping","微软认证开发专家(MCSD)");
		}else if("22".equals(map.get("jsjshuiping"))){
			map.put("jsjshuiping","Cisco职业资格认证CCNA");
		}else if("23".equals(map.get("jsjshuiping"))){
			map.put("jsjshuiping","isco职业资格认证CCDP");
		}else if("24".equals(map.get("jsjshuiping"))){
			map.put("jsjshuiping","Cisco职业资格认证CCNP");
		}else if("25".equals(map.get("jsjshuiping"))){
			map.put("jsjshuiping","Cisco职业资格认证CCIE");
		}else if("26".equals(map.get("Oracle8数据库管理员"))){
			map.put("jsjshuiping","中 级");
		}else if("27".equals(map.get("jsjshuiping"))){
			map.put("jsjshuiping","Lotus资格认证");
			
//			  case 28 jsjshuiping="Lotus-CLS资格认证 "
//			  case 29 jsjshuiping="Lotus-CLI资格认证" 
//			  case 30 jsjshuiping="Notes应用开发工程师" 
//			  case 31 jsjshuiping="Notes系统管理工程师" 
//			  case 32 jsjshuiping="Notes高级应用开发工程师"
//			  case 33 jsjshuiping="Notes高级系统管理工程师"
//			  case 34 jsjshuiping="IBM-DB2 Database Administrator"
//			  case 35 jsjshuiping="IBM-DB2 Application Developer" 
//			  case 36 jsjshuiping="IBM-MQSeries  Engineer"
			
		}else if("28".equals(map.get("jsjshuiping"))){
			map.put("jsjshuiping","Lotus-CLS资格认证");
		}else if("29".equals(map.get("jsjshuiping"))){
			map.put("jsjshuiping","Lotus-CLI资格认证");
		}else if("30".equals(map.get("jsjshuiping"))){
			map.put("jsjshuiping","Notes应用开发工程师");
		}else if("31".equals(map.get("jsjshuiping"))){
			map.put("jsjshuiping","Notes系统管理工程师");
		}else if("32".equals(map.get("jsjshuiping"))){
			map.put("jsjshuiping","Notes高级应用开发工程师");
		}else if("33".equals(map.get("jsjshuiping"))){
			map.put("jsjshuiping","Notes高级系统管理工程师");
		}else if("34".equals(map.get("jsjshuiping"))){
			map.put("jsjshuiping","IBM-DB2 Database Administrator");
		}else if("35".equals(map.get("jsjshuiping"))){
			map.put("jsjshuiping","IBM-DB2 Application Developer");
		}else if("36".equals(map.get("jsjshuiping"))){
			map.put("jsjshuiping","IBM-MQSeries  Engineer");
		}

		if("0".equals(map.get("xueli"))){
			map.put("xueli","初 中");
		}else if("1".equals(map.get("xueli"))){
			map.put("xueli","高 中");
		}else if("2".equals(map.get("xueli"))){
			map.put("xueli","中 专");
		}else if("3".equals(map.get("xueli"))){
			map.put("xueli","大 专");
		}else if("4".equals(map.get("xueli"))){
			map.put("xueli","本 科");
		}else if("5".equals(map.get("xueli"))){
			map.put("xueli","硕 士");
		}else{
			map.put("xueli","大 专");
		}
	}
	/**
	 * 删除个人图片
	 * @return
	 * @throws Exception
	 */
	public String doDelPic() throws Exception {
		// 采用连接池
		HttpServletRequest request = ServletActionContext.getRequest();
		String picname=request.getParameter("picname");
		boolean  mesg=false;
		Map userInfo=this.getUserInfo();
		if(userInfo !=null){
			ActionContext ac = ActionContext.getContext();
			ServletContext sc = (ServletContext) ac.get(ServletActionContext.SERVLET_CONTEXT);
			String savePath = sc.getRealPath("/");
			savePath = savePath + "/uploadfile/photo/";
			File file = new File(savePath + picname);
			file.delete();
			Vector params = new Vector();
	
			params.add("");
			params.add("0");
			params.add((String)userInfo.get("username"));
			params.add((String)userInfo.get("jobid"));
			StringBuffer sql=new StringBuffer("update person  set photo=? ,phototre=? where username=? and jobid=?");
			mesg= DBHelper.execute(sql.toString(), params);
			ConncenFactory.commitAndClose(); // 关闭连接    // 关闭连接
		}
		
		this.setAjaxMessage(mesg+"");
		return "ajax";
	}
	
	
	// where jobid='"&jobid&"' and UserName='"&UserName&"'"
	/**
	 * 获取Ip地址
	 * @return
	 */
	protected String getIpAddr() {
		HttpServletRequest request = ServletActionContext.getRequest();
		String ip = request.getHeader("x-forwarded-for");
		if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
			ip = request.getHeader("Proxy-Client-IP");
		}
		if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
			ip = request.getHeader("WL-Proxy-Client-IP");
		}
		if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
			ip = request.getRemoteAddr();
		}
		return ip;
	}
	
	
	
	

}
